Remove little-endian assumption from library code.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 29 Jan 2007 17:01:53 +0000 (17:01 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 29 Jan 2007 17:01:53 +0000 (17:01 +0000)
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/common/lib.c

index c3e77d3cfaed813c46804d0980df0cf470a30cee..2f1a005ca4282a122cb258a23f23c272c313aae7 100644 (file)
@@ -2,6 +2,7 @@
 #include <xen/ctype.h>
 #include <xen/lib.h>
 #include <xen/types.h>
+#include <asm/byteorder.h>
 
 /* for ctype.h */
 unsigned char _ctype[] = {
@@ -80,9 +81,15 @@ union uu {
     long           sl[2];          /* as two signed longs */
     unsigned long  ul[2];          /* as two unsigned longs */
 };
-/* XXX RN: Yuck hardcoded endianess :) */
+
+#ifdef __BIG_ENDIAN
+#define _QUAD_HIGHWORD 0
+#define _QUAD_LOWWORD 1
+#else /* __LITTLE_ENDIAN */
 #define _QUAD_HIGHWORD 1
 #define _QUAD_LOWWORD 0
+#endif
+
 /*
  * Define high and low longwords.
  */